//
//  LoginViewController.m
//  悟空市场1.0
//
//  Created by 纵情向前 on 2017/3/16.
//  Copyright © 2017年 纵情向前科技有限公司. All rights reserved.
//

#import "AdapterTool.h"
#import <UIKit/UIKit.h>
#define SCREEN_W [UIScreen mainScreen].bounds.size.width
#define SCREEN_H [UIScreen mainScreen].bounds.size.height

#define W_Adapter SCREEN_W/375.0
#define H_Adapter SCREEN_H/667.0

@implementation AdapterTool

+ (CGRect)getAdapterRectWithRect:(CGRect)rect isHeight:(BOOL)isHeight{
    CGRect newRect = CGRectZero;
    newRect.origin = [self getNewPointWithPoint:rect.origin];
    newRect.size = [self getNewSizeWithSize:rect.size isHeight:isHeight];
    return newRect;
}
+ (CGPoint)getNewPointWithPoint:(CGPoint)point {
    CGPoint newPoint = CGPointZero;
    newPoint.x = point.x * W_Adapter;
    newPoint.y = point.y * H_Adapter;
    return newPoint;
}
+ (CGSize)getNewSizeWithSize:(CGSize)size isHeight:(BOOL)isHeight{
    CGSize newSize = CGSizeZero;
    newSize.width = size.width * W_Adapter;
    if (isHeight) {
        newSize.height = size.height * H_Adapter;
    }else{
        newSize.height = size.height * W_Adapter;
    }
    return newSize;
}



@end
